package domain.web.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import domain.web.dao.DetailDao;
import domain.web.dao.RegionDao;
import domain.web.model.DetailView;
import domain.web.service.DetailService;

@Service("detailService")
public class DetailServiceImpl implements DetailService {

	@Autowired
	private DetailDao detailDao;
	@Autowired
	private RegionDao regionDao;
	
	@Override
	public List<DetailView> getViewListByProduct(long productId) {
		List<DetailView> detailViews =detailDao.getViewListByProduct(productId);
		for (DetailView detailView : detailViews) {
			detailView.setRegions(regionDao.getListByStore(detailView.getStoreId(), "en"));
		}
		return detailViews;
	}

}
